<?php 
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
MYDCONN();
$prtHtml = ''; ?>
<table width="100%"  border="0" cellpadding="3" cellspacing="1">
  <tr bgcolor="#F2F2F2" onMouseOver="bgcolor='#FFFFFF'">
    <td width="10%" onMouseOver="bgcolor='#FFFFFF'">Referencia</td>
    <td width="10%" onMouseOver="bgcolor='#FFFFFF'">Funcionário</td>
    <td width="40%" bgcolor="#F2F2F2">ObservaÇ&otilde;es</td>
    <td width="8%">Estado</td>
    <td width="14%">Criado</td>
    <td width="14%">Entregue</td>
    <td width="14%">Aprovado</td>
  </tr>
    <?php
	$GET = $GLOBALS['MYD']->db_array("SELECT 
					main_users.name AS RefUser,
					ccenter_requests.Ref,
					ccenter_requests.Observations,
					hcce_status.name AS Status,
					ccenter_requests.TimeCreated,
					ccenter_requests.TimeDelivered,
					ccenter_requests.RefSupervisor
				FROM ccenter_requests
				INNER JOIN main_users ON main_users.ref = RefUser
				INNER JOIN hcce_status ON hcce_status.ref = ccenter_requests.Status
				WHERE TimeCreated BETWEEN '{$_POST['DateStart']} 00:00:00' AND '{$_POST['DateEnd']} 23:59:59' AND RefOffice = {$_SESSION[$SESSOF]}
				AND Status > 0
				ORDER BY ccenter_requests.TimeCreated DESC"); 
	for ($f = 1; $f <= $GET[0]; $f++) { 
	 echo '<tr bgcolor="#D3D6E4">
		<td width="10%">';
		mn_field('button','ED','vwRequest',$GET[$f]['Ref'],'','','','" onclick="
			idwindow(\'Propriedades do pedidos de Materiais\',\'winreq\',\'winreq\',\'Modules/CentrodeCustos/Lib/frm_requests.php?rqID='.$GET[$f]['Ref'].'\',800,500);');
	echo '</td>
		<td width="10%">'.$GET[$f]['RefUser'].'</td>
		<td width="40%">'.$GET[$f]['Observations'].'</td>
		<td width="8%">'.$GET[$f]['Status'].'</td>
		<td width="14%">'.$GET[$f]['TimeCreated'].'</td>
		<td width="14%">'.$GET[$f]['TimeDelivered'].'</td>
		<td width="14%">'.$GET[$f]['RefSupervisor'].'</td>
		</tr>';
   } 
   echo $prtHtml; ?>
  </table>